import 'package:auto_size_text/auto_size_text.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:znmm/UI/A_Common/buttons/easy_button/easy_elevated_button.dart';
import 'package:znmm/UI/ProductPages/view/product_all_view.dart';
import 'package:znmm/config/app_color.dart';

class SecendView extends StatelessWidget {
  const SecendView({super.key});

  @override
  Widget build(BuildContext context) {
    return Container(
      color: AppColor.greyD8D8D8,
      height: 60,
      child: Padding(
        padding: const EdgeInsets.symmetric(horizontal: 10.0),
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceEvenly, // 均匀分布
          crossAxisAlignment: CrossAxisAlignment.center,
          children: [
            _buildCouponCard('US\$5', ' Over \$60'),
            _buildCouponCard('US\$10', ' Over \$109'),
            _buildCouponCard('US\$15', ' Over \$169'),
            EasyElevatedButton(
              label: 'GET COUPON',
              //color: Colors.blue,
              onPressed: () {
                Get.to(const ProductAllView());
              },
            ),
          ],
        ),
      ),
    );
  }

  // 构建优惠卡片
  Widget _buildCouponCard(String amount, String condition) {
    return Column(
      mainAxisSize: MainAxisSize.min,
      children: [
        Text(
          amount,
          style: const TextStyle(
            fontSize: 14,
            fontWeight: FontWeight.bold,
            color: Colors.black,
          ),
        ),
        const SizedBox(height: 8),
        AutoSizeText(
          condition,
          style: const TextStyle(
            fontSize: 12,
            color: Colors.black,
          ),
          maxLines: 4,
          minFontSize: 10.0, // 设置最小字体大小
          overflow: TextOverflow.ellipsis, // 超出时显示省略号
        ),
      ],
    );
  }
}
